package org.example.salesystem.controller;

import org.example.salesystem.entity.ResultBody;
import org.example.salesystem.service.ChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/chat")
@CrossOrigin(origins="*")
public class ChatController {
    @Autowired
    private ChatService chatService;
    @RequestMapping("/addChat")
    public ResultBody addChat(@RequestBody Map<String,Object> map){
//        System.out.println(map);
        //将值进行传下去
        return chatService.addChat(map);
    }
    @RequestMapping("/displayChat")
    public ResultBody displayChat(@RequestBody Map<String,Object> map){
        return chatService.displayChat(map);
    }
    @RequestMapping("/addChatU")
    public ResultBody addChatU(@RequestBody Map<String,Object> map){
        //将值进行传下去
        return chatService.addChatU(map);
    }
    @RequestMapping("/displayChatU")
    public ResultBody displayChatU(){
        return chatService.displayChatU();
    }
}
